package core.validate.rules;

import core.validate.BooleanRule;
import core.validate.RuleTest;

import java.util.List;

public enum BooleanType {
    TEST, REGEX, NOT_REGEX, IN, NOT_IN, EMPTY;
    public void apply(BooleanRule rule, List<Object> params, String message) {
        switch (this) {
            case TEST -> rule.test((RuleTest) params.get(0), message);
            case REGEX -> rule.regex((String) params.get(0), message);
            case NOT_REGEX -> rule.notRegex((String) params.get(0), message);
            case IN -> rule.in((Object[]) params.get(0), message);
            case NOT_IN -> rule.notIn((Object[]) params.get(0), message);
        }
    }
}
